/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Modelo;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author ChArFaTo
 */
@Entity
@Table(name = "salon", catalog = "proyectosw", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SalonEJB.findAll", query = "SELECT s FROM SalonEJB s"),
    @NamedQuery(name = "SalonEJB.findBySCodigo", query = "SELECT s FROM SalonEJB s WHERE s.sCodigo = :sCodigo"),
    @NamedQuery(name = "SalonEJB.findBySNombre", query = "SELECT s FROM SalonEJB s WHERE s.sNombre = :sNombre"),
    @NamedQuery(name = "SalonEJB.findBySCapacidad", query = "SELECT s FROM SalonEJB s WHERE s.sCapacidad = :sCapacidad"),
    @NamedQuery(name = "SalonEJB.findBySTipoSalon", query = "SELECT s FROM SalonEJB s WHERE s.sTipoSalon = :sTipoSalon")})
public class SalonEJB implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer sCodigo;
    @Size(max = 255)
    @Column(length = 255)
    private String sNombre;
    @Basic(optional = false)
    @NotNull
    @Column(nullable = false)
    private int sCapacidad;
    @Size(max = 255)
    @Column(length = 255)
    private String sTipoSalon;
    @OneToMany(mappedBy = "salonSCodigo")
    private Collection<HorarioEJB> horarioEJBCollection;
    @JoinColumn(name = "GrupoGCodigo", referencedColumnName = "GCodigo")
    @ManyToOne
    private GrupoEJB grupoGCodigo;

    public SalonEJB() {
    }

    public SalonEJB(Integer sCodigo) {
        this.sCodigo = sCodigo;
    }

    public SalonEJB(Integer sCodigo, int sCapacidad) {
        this.sCodigo = sCodigo;
        this.sCapacidad = sCapacidad;
    }

    public Integer getSCodigo() {
        return sCodigo;
    }

    public void setSCodigo(Integer sCodigo) {
        this.sCodigo = sCodigo;
    }

    public String getSNombre() {
        return sNombre;
    }

    public void setSNombre(String sNombre) {
        this.sNombre = sNombre;
    }

    public int getSCapacidad() {
        return sCapacidad;
    }

    public void setSCapacidad(int sCapacidad) {
        this.sCapacidad = sCapacidad;
    }

    public String getSTipoSalon() {
        return sTipoSalon;
    }

    public void setSTipoSalon(String sTipoSalon) {
        this.sTipoSalon = sTipoSalon;
    }

    @XmlTransient
    public Collection<HorarioEJB> getHorarioEJBCollection() {
        return horarioEJBCollection;
    }

    public void setHorarioEJBCollection(Collection<HorarioEJB> horarioEJBCollection) {
        this.horarioEJBCollection = horarioEJBCollection;
    }

    public GrupoEJB getGrupoGCodigo() {
        return grupoGCodigo;
    }

    public void setGrupoGCodigo(GrupoEJB grupoGCodigo) {
        this.grupoGCodigo = grupoGCodigo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sCodigo != null ? sCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SalonEJB)) {
            return false;
        }
        SalonEJB other = (SalonEJB) object;
        if ((this.sCodigo == null && other.sCodigo != null) || (this.sCodigo != null && !this.sCodigo.equals(other.sCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Modelo.SalonEJB[ sCodigo=" + sCodigo + " ]";
    }
    
}
